package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.dao.IWeiboUserDAO;
import org.jsbd.boss.domian.channel.MarkDayTask;
import org.jsbd.boss.domian.channel.RetentTaskVo;
import org.jsbd.boss.domian.channel.WeiBoVo;
import org.jsbd.boss.domian.channel.WeiboUser;
import org.springframework.stereotype.Service;

import edu.hziee.common.queue.IBatchExecutor;

@Service("weiboUserDao")
public class WeiboUserDAOImpl extends CrackLogBaseDao implements IBatchExecutor<WeiboUser>, IWeiboUserDAO {

	@Override
	public void execute(List<WeiboUser> records) {
		super.batchInsert("qy_weibo_user.INSERT_USER", records);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jsbd.boss.dao.IWeiboUserDAO#selectUserList(java.lang.Integer,
	 * java.lang.Integer)
	 */
	@Override
	public List<WeiboUser> selectUserList(Integer start, Integer provinceId, Integer length) {
		Map<String, Object> map = new HashMap<>();
		map.put("start", start);
		map.put("length", length);
		map.put("provinceId", provinceId);
		return super.queryForList("qy_weibo_user.SELECT_USER_LIST", map);
	}

	@Override
	public WeiboUser selectUser(String imsi) {
		Map<String, Object> map = new HashMap<>();
		map.put("imsi", imsi);
		return (WeiboUser) super.queryForObject("qy_weibo_user.SELECT_USER_INFO", map);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jsbd.boss.dao.IWeixinUserDAO#selectRetentTaskList(int,
	 * java.lang.Integer)
	 */
	@Override
	public List<RetentTaskVo> selectRetentTaskList(Integer length, Integer currentDay, String mark) {
		Map<String, Object> map = new HashMap<>();
		map.put("currentDay", currentDay);
		map.put("length", length);
		map.put("mark", mark);
		return (List<RetentTaskVo>) super.queryForList("qy_weibo_user.SELECT_USER_LIST_RETENT", map);
	}
	
	
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jsbd.boss.dao.IWeixinUserDAO#selectRetentTaskList(int,
	 * java.lang.Integer)
	 */
	@Override
	public List<RetentTaskVo> selectFilterRetentTaskList(Integer length, Integer currentDay, String mark, Integer actionType) {
		Map<String, Object> map = new HashMap<>();
		map.put("currentDay", currentDay);
		map.put("length", length);
		map.put("mark", mark);
		map.put("actionType", actionType);
		return (List<RetentTaskVo>) super.queryForList("qy_weibo_user.SELECT_FILTER_USER_LIST_RETENT", map);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jsbd.boss.dao.IWeiboUserDAO#selectRetentTaskList()
	 */
	@Override
	public List<MarkDayTask> selectRetentTaskList() {
		return super.queryForList("qy_weibo_user.SELECT_USER_COUNT_RETENT");
	}

	@Override
	public void updateMark(String mark) {
		super.update("qy_weibo_user.UPDATE_MARK", mark);
	}

	
	@Override
	public List<WeiBoVo> getWeiBoHandler(WeiBoVo weiBo) {
		return super.queryForList("qy_weibo_user.GET_WEIBO_HANDLER", weiBo);
	}
	
	
}
